define([
    'vue',
    'jquery',
    'garden-modal',
    'iview',
    'private-residence-modal',
    'workshop-modal',
    'land-modal',
    'paging'
],function (Vue, $, gardenModal, iview, privateResidenceModal, workshopModal, landModal, Paging) {
    $(function () {
        //        点击放大放小效果
        $(".clickBig").click(function () {
            $(".list-details").animate({
                width: $("body").width(),
                height: $("body").height() - 50,
                'margin-left': -$("body").width() / 2,
                'margin-top': -$("body").height() / 2 - 40
            })
            $(".message-box").animate({width: "100%", height: "100%", 'margin-left': 0, left: "0", top: "40"});
            $(".listings-box .ivu-modal").animate({width: '100%', height: "100%",});
            $(".addListings-box .ivu-modal").animate({width: '100%', height: "100%",});
            $(".vertical-center-modal .addListings-ul").animate({height: $(".ivu-modal").height()});
            $(".vertical-center-modal .housing-details").animate({height: $(".ivu-modal").height()});

            $(".housing-details").animate({height: '90%'});

            $(".clickMin").show();
            $(".clickBig").hide();

        })

        $(".clickMin").click(function () {
            $(".listings-box .ivu-modal").animate({width: '1100px', height: "577",});
            $(".addListings-box .ivu-modal").animate({width: '1100px', height: "577",});
            $(".list-details").animate({width: '1100px', height: "577", 'margin-left': -'550', 'margin-top': -'345'});
            $(".addListings-ul").animate({height: "78%"});
            $(".housing-details").animate({height: "510",});

            $(".clickMin").hide();
            $(".clickBig").show();
        })

//        $(window).resize(function () {
//            $(".listings-box .ivu-modal").animate({width: '1100px', height: "577",});
//            $(".addListings-box .ivu-modal").animate({width: '1100px', height: "577",});
//            $(".list-details").animate({width: '1100px', height: "577", 'margin-left': -'550', 'margin-top': -'305'});
//            $(".addListings-ul").animate({height: "78%"});
//            $(".housing-details").animate({height: "510",});
//
//            $(".clickMin").hide();
//            $(".clickBig").show();
//        }).resize();
//        ==============================

        $(".listings-tags span").hover(function () {
            $(this).children("em").toggle();
        });
//        业主信息联系电话下拉
        $("<img src='../../images/sc.png'/>").addClass("shanchu").appendTo(".menuIte-bg");
        $(".shanchu").click(function () {
                $(this).parent().hide();
            }
        )


        //填写最新回访记录
        $(".newVisit").prev().css({"position": "relative", "height": "0"});
        $(".newVisit").find(".ivu-modal").css("box-shadow", "0px 1px 10px rgba(0,0,0,0.5)");

    })

    Vue.use(iview)
    //定义一个空的vue实例, 作为 不同组件之间沟通的渠道.
    var bus = new Vue();
    /*筛选条件和地图找房*/
    Vue.component('screen-pannel', {
        template: "#screen-pannel-template",
        data: function () {
            return {
                /*筛选条件*/
                screeningCondition: "",
                condition: [
                    {label: "筛选条件1", value: "strong"},
                    {label: "筛选条件2", value: "normal"},
                ],
            }
        },
        methods: {
            search: function () {
                $.get(function (data) {
                    bus.$emit(data);//通过 bus 发布事件.
                });
            }
        }
    });


//=======================================
    /*所有房源表格模板开始*/
    Vue.component('all-table-pannel', {
        template: "#all-table-pannel-template",
        components: {
            paging: Paging,
            gardenModal:gardenModal,
            privateResidenceModal:privateResidenceModal,
            workshopModal:workshopModal,
            landModal:landModal
        },
        data: function () {
            return {
                gardenAmapId: 'allGardenAmapId',
                privateAddMapId: 'allPrivateAddHouseAmapId',
                privateMapId: 'allPrivateAmapId',
                workshopAddMapId: 'allWorkshopAddHouseAmapId',
                workshopMapId: 'allWorkshopAmapId',
                landAddMapId: 'allLandAddHouseAmapId',
                landAmapId: 'allLandAmapId',
                amapDomId: 'all-amap',
                objInfo: {},
                isShowModal: false,
                delObjId: {},
                deletePos: false,
                gardenShow: false,
                privateShow: false,
                workshopShow: false,
                landShow: false,
                totalRows:0,
                pageSize:10,
                pageIndex:0,
                showType:0,
                /*房源类别*/
                housingResources: "",
                resources: [
                    {label: "房源类别1", value: "房源类别1"},
                    {label: "房源类别2", value: "房源类别2"}
                ],
                sort: [
                    {
                        value: 'morenpaixuy',
                        label: '默认排序1',
                    },
                    {
                        value: 'morenpaixue',
                        label: '默认排序2'
                    },
                    {
                        value: 'morenpaixus',
                        label: '默认排序3'
                    }
                ],
                /*房源区域*/
                housingArea: "",
                area: [
                    {label: "海口市", value: "海口市"},
                    {label: "三亚市", value: "三亚市"},
                    {label: "陵水县", value: "陵水县"}
                ],
                /*售价范围*/
                priceRange: "",
                range: [
                    {label: "不限", value: "不限"},
                    {label: "200万以下", value: "200万以下"},
                    {label: "200万以上", value: "200万以上"}
                ],
                /*面积范围*/
                areaScope: "",
                scope: [
                    {label: "不限", value: "不限"},
                    {label: "1万平米", value: "1万平米"},
                    {label: "2万平米", value: "2万平米"}
                ],
                /*特藏属性*/
                attribute: "",
                attributeM: [
                    {label: "全部房源", value: "全部房源"},
                    {label: "全部房源1", value: "全部房源1"},
                    {label: "全部房源2", value: "全部房源2"}
                ],
                keyword: "",
                defaultSort:'',
                columnsList: [],
                listTableData: []
            }
        },
        watch: {
            listTableData: function () {
                this.totalRows = this.listTableData.length
            },
            housingResources: function () {
                this.getSearchData()
            },
            housingArea: function () {
                this.getSearchData()
            },
            priceRange: function () {
                this.getSearchData()
            },
            areaScope: function () {
                this.getSearchData()
            },
            attribute: function () {
                this.getSearchData()
            }
        },
        created: function () {
            this.initData()
            this.initCol()
        },
        methods: {
            onAdd: function (obj) {
                this.listTableData.push(obj)
            },
            onEdit: function (obj) {
                for(var i = 0; i < this.listTableData.length; i++){
                    if (this.listTableData[i].id === obj.id){
                        this.listTableData[i] = obj
                    }
                }
                this.listTableData = this.listTableData.slice()
            },
            initCol: function () {
                var that = this
                this.columnsList = [
                    {
                        type: 'selection',
                        width: '2.78%',
                        align: 'left'
                    },
                    {
                        title: '房源状态',
                        width: '8.72%',
                        key: 'state',
                        className: 'availability-status',
                        sortable: true,
                        render: function (h, params) {
                            var style = ""
                            var statusMsg = ''
                            var imgUrl = ''
                            if (params.row.mediaInfo.imgList.length > 0){
                                imgUrl = params.row.mediaInfo.imgList[0].url
                            } else if(params.row.mediaInfo.panorama.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.panorama[0].url
                            } else if (params.row.mediaInfo.videoInfo.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.videoInfo[0].url
                            } else {
                                imgUrl = '../images/1.png'
                            }
                            switch (params.row.status) {
                                case "0": {
                                    style = "hair"
                                    statusMsg = '发'
                                    break
                                }
                                case "1": {
                                    style = "can"
                                    statusMsg = '审'
                                    break
                                }
                                case "2": {
                                    style = "trial"
                                    statusMsg = '待'
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'availability-status'
                                },
                                style: {
                                    'background-image': 'url(' + imgUrl + ')'
                                }
                            }, [
                                h('em', {
                                    attrs: {
                                        class: style
                                    }
                                }, statusMsg)
                            ])
                        }
                    },
                    {
                        title: '房源标题/房源位置',
                        className: 'title-position',
                        key: 'titlePosition',
                        sortable: true,
                        width: '23%',
                        render: function (h, params) {
                            var style = ""
                            switch (params.row.publicStatus) {
                                case "0": {
                                    style = "jie"
                                    break
                                }
                                case "1": {
                                    style = "gong"
                                    break
                                }
                                case "2": {
                                    style = "cang"
                                    break
                                }
                            }
                            switch (params.row.type){
                                case '0':{
                                    return h('div', {
                                        attrs: {
                                            class: 'houseTitle title-position'
                                        }
                                    }, [
                                        h('strong', [
                                            h('span', params.row.title),
                                            h('i', {
                                                attrs: {
                                                    class: style
                                                }
                                            })
                                        ]),
                                        h('p', {
                                            domProps: {
                                                innerHTML: params.row.garden.city + params.row.garden.area + params.row.garden.address
                                            }
                                        })
                                    ])
                                }
                                case '1':{
                                    return h('div', {
                                        attrs: {
                                            class: 'houseTitle title-position'
                                        }
                                    }, [
                                        h('strong', [
                                            h('span', params.row.title),
                                            h('i', {
                                                attrs: {
                                                    class: style
                                                }
                                            })
                                        ]),
                                        h('p', {
                                            domProps: {
                                                innerHTML: params.row.houseInfo.city + params.row.houseInfo.area + params.row.houseInfo.address
                                            }
                                        })
                                    ])
                                }
                                case '2':{
                                    return h('div', {
                                        attrs: {
                                            class: 'houseTitle title-position'
                                        }
                                    }, [
                                        h('strong', [
                                            h('span', params.row.title),
                                            h('i', {
                                                attrs: {
                                                    class: style
                                                }
                                            })
                                        ]),
                                        h('p', {
                                            domProps: {
                                                innerHTML: params.row.basicInfo.city + params.row.basicInfo.area + params.row.basicInfo.address
                                            }
                                        })
                                    ])
                                }
                                case '3':{
                                    return h('div', {
                                        attrs: {
                                            class: 'houseTitle title-position'
                                        }
                                    }, [
                                        h('strong', [
                                            h('span', params.row.title),
                                            h('i', {
                                                attrs: {
                                                    class: style
                                                }
                                            })
                                        ]),
                                        h('p', {
                                            domProps: {
                                                innerHTML: params.row.basicInfo.city + params.row.basicInfo.area + params.row.basicInfo.address
                                            }
                                        })
                                    ])
                                }
                            }
                        }
                    },
                    {
                        title: '建议售价/业主底价',
                        width: '12%',
                        key: 'lowPrice',
                        render: function (h, params) {
                            return h('div', [
                                h('span', params.row.introPrice.price),
                                h('span', '/'),
                                h('span', params.row.introPrice.lowPrice)
                            ])
                        }
                    },
                    {
                        title: '户型/面积',
                        key: 'sizeArea',
                        width: '10.35%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', {
                                    domProps: {
                                        innerHTML: params.row.doorInfo.room + '  室  ' + params.row.doorInfo.living + '  厅'
                                    }
                                }),
                                h('p', params.row.doorInfo.roomBuildingArea)
                            ])
                        }
                    },
                    {
                        title: '录入信息',
                        key: 'inputInformation',
                        width: '9.42%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.enterInfo.name),
                                h('p', params.row.enterInfo.enterTime)
                            ])
                        }
                    },
                    {
                        title: '业主信息',
                        key: 'ownerInformation',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.ownerInformation.name),
                                h('p', params.row.ownerInformation.mainPhone)
                            ])
                        }
                    },
                    {
                        title: '房源标签',
                        key: 'listingsTags',
                        width: '180',
                        render: function (h, params) {
                            var tempTag = []

                            params.row.livingInDetails.forEach(function (t, index) {
                                if (t.show) {
                                    tempTag.push(h('span', {
                                        attrs: {
                                            class: 'biaoqian-' + (index + 1)
                                        }
                                    }, t.key))
                                }
                            });
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, tempTag)
                        }
                    },
                    {
                        title: '操作',
                        width: '10%',
                        render: function (h, params) {
                            // asd
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, [
                                h('span', {
                                    attrs: {
                                        class: 'see villageSee'
                                    },
                                    on: {
                                        click: function () {
                                            that.objInfo = params.row
                                            that.showType = 0
                                            switch (params.row.type){
                                                case '0':{
                                                    that.gardenShow = true
                                                    break
                                                }
                                                case '1':{
                                                    that.privateShow = true
                                                    break
                                                }
                                                case '2':{
                                                    that.workshopShow = true
                                                    break
                                                }
                                                case '3':{
                                                    that.landShow = true
                                                    break
                                                }
                                            }
                                        }
                                    }
                                }, [
                                    h('em', '查看')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'l-upload'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'release'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '一键发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'modify'
                                    },
                                    on: {
                                        click: function () {
                                            that.showType = 1
                                            that.show = true
                                            that.gardenInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '修改')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'move-defaut'
                                    },
                                    on: {
                                        click: function () {
                                            that.delObjId = params.row.id
                                            that.deletePos = true
                                        }
                                    }
                                }, [
                                    h('em', '删除')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'recovery'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('恢复成功')
                                                } else {
                                                    that.$Message.error('恢复失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '恢复')
                                ])
                            ])
                        }
                    }
                ]
            },
            showAddHouse: function () {
                this.isShowModal = true
            },
            getSearchData: function () {
                var that = this
                $.getJSON(
                    '../../data/house/mock_garden_info.json',
                    {
                        housingResources: this.housingResources,
                        housingArea: this.housingArea,
                        priceRange: this.priceRange,
                        areaScope: this.areaScope,
                        attribute: this.attribute,
                        keyword: this.keyword,
                    },
                    function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                            debugger
                        }
                    }, function (err) {

                    }
                )
            },
            handleSuccessDel: function () {
                var that = this
                this.listTableData.forEach(function (t, index) {
                    if (t.id === that.delObjId) {
                        that.listTableData.splice(index, 1)
                    }
                })

            },
            search: function () {
                this.getSearchData()
            },
            initData: function () {
                var that = this
                $.getJSON("../../data/house/mock_all_info.json")
                    .done(function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    })
            },
            ok: function () {
                this.$Message.info('点击了确定');
            },
            cancel: function () {
                this.$Message.info('点击了取消');
            }
        }
    });

    /*小区楼盘表格模板开始*/
    Vue.component('village-table-pannel', {
        template: "#village-table-pannel-template",
        components: {
            gardenModal: gardenModal,
            paging: Paging,

        },
        data: function () {
            return {
                showType: 0,
                addHouseAmapId: 'gardenAddHouseAmapId',
                amapId: 'gardenAmapId',
                deletePos: false,
                show: false,
                /*房源类别*/
                housingResources: "",
                resources: [
                    {label: "房源类别1", value: "房源类别1"},
                    {label: "房源类别2", value: "房源类别2"},
                ],
                /*房源区域*/
                housingArea: "",
                area: [
                    {label: "海口市", value: "海口市"},
                    {label: "三亚市", value: "三亚市"},
                    {label: "陵水县", value: "陵水县"},
                ],
                /*售价范围*/
                priceRange: "",
                range: [
                    {label: "不限", value: "不限"},
                    {label: "200万以下", value: "200万以下"},
                    {label: "200万以上", value: "200万以上"},
                ],
                /*面积范围*/
                areaScope: "",
                scope: [
                    {label: "不限", value: "不限"},
                    {label: "1万平米", value: "1万平米"},
                    {label: "2万平米", value: "2万平米"},
                ],

                /*房源户型*/
                housingUnits: "",
                units: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],

                /*房龄*/
                age: "",
                ageM: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],

                /*特藏属性*/
                attribute: "",
                attributeM: [
                    {label: "全部房源", value: "全部房源"},
                    {label: "全部房源1", value: "全部房源1"},
                    {label: "全部房源2", value: "全部房源2"},
                ],
                /*装修等级*/
                renovation: "",
                renovationM: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],

                keyword: "",
                amapDomId: 'addVillage',
                /*默认排序*/
                sort: [
                    {
                        value: 'morenpaixuy',
                        label: '默认排序1',
                    },
                    {
                        value: 'morenpaixue',
                        label: '默认排序2'
                    },
                    {
                        value: 'morenpaixus',
                        label: '默认排序3'
                    }
                ],
                defaultSort: '',
                isShowModal: false,
                listTableData: [],
                columnsList: [],
                gardenInfo: {},
                delObjId: '',
                totalRows:0,
                pageSize:10,
                pageIndex:0
            }
        },
        created: function () {
            this.initData()
            this.initColumns()
        },
        watch: {
            listTableData: function () {
                this.totalRows = this.listTableData.length
            },
            housingResources: function () {
                this.getSearchData()
            },
            housingArea: function () {
                this.getSearchData()
            },
            priceRange: function () {
                this.getSearchData()
            },
            areaScope: function () {
                this.getSearchData()
            },
            housingUnits: function () {
                this.getSearchData()
            },
            age: function () {
                this.getSearchData()
            },
            attribute: function () {
                this.getSearchData()
            },
            renovation: function () {
                this.getSearchData()
            }
        },
        methods: {
            editGarden: function (obj) {
                for(var i = 0; i < this.listTableData.length; i++){
                    if (this.listTableData[i].id === obj.id){
                        this.listTableData[i] = obj
                    }
                }
                this.listTableData = this.listTableData.slice()
            },
            addGarden: function (obj) {
                this.listTableData.push(obj)
            },
            search: function () {
                this.getSearchData()
            },
            getSearchData: function () {
                var that = this
                $.getJSON(
                    '../../data/house/mock_garden_info.json',
                    {
                        housingResources: this.housingResources,
                        housingArea: this.housingArea,
                        priceRange: this.priceRange,
                        areaScope: this.areaScope,
                        housingUnits: this.housingUnits,
                        age: this.age,
                        attribute: this.attribute,
                        renovation: this.renovation,
                        keyword: this.keyword,
                        page: this.pageIndex
                    },
                    function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    }, function (err) {

                    }
                )
                this.listTableData = this.listTableData.splice()
            },

            showAddHouse: function () {
                this.show = true
                this.showType = 2
            },
            initColumns: function () {
                var that = this
                this.columnsList = [
                    {
                        type: 'selection',
                        width: '2.78%',
                        align: 'left'
                    },
                    {
                        title: '房源状态',
                        width: '8.72%',
                        key: 'state',
                        className: 'availability-status',
                        sortable: true,
                        render: function (h, params) {
                            var style = ""
                            var statusMsg = ''
                            var imgUrl = ''
                            if (params.row.mediaInfo.imgList.length > 0){
                                imgUrl = params.row.mediaInfo.imgList[0].url
                            } else if(params.row.mediaInfo.panorama.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.panorama[0].url
                            } else if (params.row.mediaInfo.videoInfo.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.videoInfo[0].url
                            } else {
                                imgUrl = '../images/1.png'
                            }
                            switch (params.row.status) {
                                case "0": {
                                    style = "hair"
                                    statusMsg = '发'
                                    break
                                }
                                case "1": {
                                    style = "can"
                                    statusMsg = '审'
                                    break
                                }
                                case "2": {
                                    style = "trial"
                                    statusMsg = '待'
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'availability-status'
                                },
                                style: {
                                    'background-image': 'url(' + imgUrl + ')'
                                }
                            }, [
                                h('em', {
                                    attrs: {
                                        class: style
                                    }
                                }, statusMsg)
                            ])
                        }
                    },
                    {
                        title: '房源标题/房源位置',
                        className: 'title-position',
                        key: 'titlePosition',
                        sortable: true,
                        width: '23%',
                        render: function (h, params) {
                            var style = ""
                            switch (params.row.publicStatus) {
                                case "0": {
                                    style = "jie"
                                    break
                                }
                                case "1": {
                                    style = "gong"
                                    break
                                }
                                case "2": {
                                    style = "cang"
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'houseTitle title-position'
                                }
                            }, [
                                h('strong', [
                                    h('span', params.row.title),
                                    h('i', {
                                        attrs: {
                                            class: style
                                        }
                                    })
                                ]),
                                h('p', {
                                    domProps: {
                                        innerHTML: params.row.garden.city + params.row.garden.area + params.row.garden.address
                                    }
                                })
                            ])
                        }
                    },
                    {
                        title: '建议售价/业主底价',
                        width: '12%',
                        key: 'lowPrice',
                        render: function (h, params) {
                            return h('div', [
                                h('span', params.row.introPrice.price),
                                h('span', '/'),
                                h('span', params.row.introPrice.lowPrice)
                            ])
                        }
                    },
                    {
                        title: '户型/面积',
                        key: 'sizeArea',
                        width: '10.35%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', {
                                    domProps: {
                                        innerHTML: params.row.doorInfo.room + '  室  ' + params.row.doorInfo.living + '  厅'
                                    }
                                }),
                                h('p', params.row.doorInfo.roomBuildingArea)
                            ])
                        }
                    },
                    {
                        title: '录入信息',
                        key: 'inputInformation',
                        width: '9.42%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.enterInfo.name),
                                h('p', params.row.enterInfo.enterTime)
                            ])
                        }
                    },
                    {
                        title: '业主信息',
                        key: 'ownerInformation',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.ownerInformation.name),
                                h('p', params.row.ownerInformation.mainPhone)
                            ])
                        }
                    },
                    {
                        title: '房源标签',
                        key: 'listingsTags',
                        width: '180',
                        render: function (h, params) {
                            var tempTag = []

                            params.row.livingInDetails.forEach(function (t, index) {
                                if (t.show) {
                                    tempTag.push(h('span', {
                                        attrs: {
                                            class: 'biaoqian-' + (index + 1)
                                        }
                                    }, t.key))
                                }
                            });
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, tempTag)
                        }
                    },
                    {
                        title: '操作',
                        width: '10%',
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, [
                                h('span', {
                                    attrs: {
                                        class: 'see villageSee'
                                    },
                                    on: {
                                        click: function () {
                                            that.show = true
                                            that.showType = 0
                                            that.gardenInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '查看')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'l-upload'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'release'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '一键发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'modify'
                                    },
                                    on: {
                                        click: function () {
                                            that.showType = 1
                                            that.show = true
                                            that.gardenInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '修改')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'move-defaut'
                                    },
                                    on: {
                                        click: function () {
                                            that.delObjId = params.row.id
                                            that.deletePos = true
                                        }
                                    }
                                }, [
                                    h('em', '删除')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'recovery'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('恢复成功')
                                                } else {
                                                    that.$Message.error('恢复失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '恢复')
                                ])
                            ])
                        }
                    }
                ]
            },
            searchData: function (pageIndex) {
                // 获取当前页码数据
                this.pageIndex = pageIndex
                this.getSearchData()
            },
            handleSuccessDel: function () {
                var that = this
                this.listTableData.forEach(function (t, index) {
                    if (t.id === that.delObjId) {
                        that.listTableData.splice(index, 1)
                    }
                })

            },
            initData: function () {
                var that = this
                $.getJSON("../../data/house/mock_garden_info.json")
                    .done(function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject

                        }
                    })
            },
            ok: function () {
                this.$Message.info('点击了确定');
            },
            cancel: function () {
                this.$Message.info('点击了取消');
            },

        }
    });

    /*自建民宅表格模板开始*/
    Vue.component('private-table-pannel', {
        template: "#private-table-pannel-template",
        components: {
            privateResidenceModal: privateResidenceModal,
            paging: Paging
        },
        data: function () {
            return {
                showType: 0,
                addMapId: 'privateAddHouseAmapId',
                mapId: 'privateAmapId',
                deletePos: false,
                delObjId: '',
                /*房源类别*/
                housingResources: "",
                resources: [
                    {label: "房源类别1", value: "房源类别1"},
                    {label: "房源类别2", value: "房源类别2"},
                ],
                /*房源区域*/
                housingArea: "",
                area: [
                    {label: "海口市", value: "海口市"},
                    {label: "三亚市", value: "三亚市"},
                    {label: "陵水县", value: "陵水县"},
                ],
                /*售价范围*/
                priceRange: "",
                range: [
                    {label: "不限", value: "不限"},
                    {label: "200万以下", value: "200万以下"},
                    {label: "200万以上", value: "200万以上"},
                ],
                /*面积范围*/
                areaScope: "",
                scope: [
                    {label: "不限", value: "不限"},
                    {label: "1万平米", value: "1万平米"},
                    {label: "2万平米", value: "2万平米"},
                ],

                /*房源户型*/
                housingUnits: "",
                units: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],

                /*房龄*/
                age: "",
                ageM: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],

                /*特藏属性*/
                attribute: "",
                attributeM: [
                    {label: "全部房源", value: "全部房源"},
                    {label: "全部房源1", value: "全部房源1"},
                    {label: "全部房源2", value: "全部房源2"},
                ],
                /*装修等级*/
                renovation: "",
                renovationM: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],

                keyword: "",
                amapDomId: 'addPrivate',
                /*默认排序*/
                sort: [
                    {
                        value: 'morenpaixuy',
                        label: '默认排序1',
                    },
                    {
                        value: 'morenpaixue',
                        label: '默认排序2'
                    },
                    {
                        value: 'morenpaixus',
                        label: '默认排序3'
                    }
                ],
                defaultSort: '',
                isShowModal: false,
                listTableData: [],
                columnsList: [],
                privateHomeInfo: {},
                show: false,
                totalRows:0,
                pageSize:10,
                pageIndex:0
            }
        },
        created: function () {
            this.initData()
            this.initColumns()
        },
        watch: {
            listTableData: function () {
                this.totalRows = this.listTableData.length
            },
            housingResources: function () {
                this.getSearchData()
            },
            housingArea: function () {
                this.getSearchData()
            },
            priceRange: function () {
                this.getSearchData()
            },
            areaScope: function () {
                this.getSearchData()
            },
            housingUnits: function () {
                this.getSearchData()
            },
            age: function () {
                this.getSearchData()
            },
            attribute: function () {
                this.getSearchData()
            },
            renovation: function () {
                this.getSearchData()
            }
        },
        methods: {
            searchData: function (pageIndex) {
                // 获取当前页码数据
                this.pageIndex = pageIndex
                this.getSearchData()
            },
            editPrivateHouse: function (obj) {
                for(var i = 0; i < this.listTableData.length; i++){
                    if (this.listTableData[i].id === obj.id){
                        this.listTableData[i] = obj
                    }
                }
                this.listTableData = this.listTableData.slice()
            },
            addPrivateHouse: function (obj) {
                this.listTableData.push(obj)
            },
            search: function () {
                this.getSearchData()
            },
            handleSuccessDel: function () {
                var that = this
                this.listTableData.forEach(function (t, index) {
                    if (t.id === that.delObjId) {
                        that.listTableData.splice(index, 1)
                    }
                })

            },
            getSearchData: function () {
                var that = this
                $.getJSON(
                    '../../data/company/mock_user.json',
                    {
                        housingResources: this.housingResources,
                        housingArea: this.housingArea,
                        priceRange: this.priceRange,
                        areaScope: this.areaScope,
                        housingUnits: this.housingUnits,
                        age: this.age,
                        attribute: this.attribute,
                        renovation: this.renovation,
                        keyword: this.keyword,
                        page: this.pageIndex
                    },
                    function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    }, function (err) {

                    }
                )
            },
            showAddHouse: function () {
                this.showType = 2
                this.show = true
            },
            initColumns: function () {
                var that = this
                this.columnsList = [
                    {
                        type: 'selection',
                        width: '2.78%',
                        align: 'left'
                    },
                    {
                        title: '房源状态',
                        key: 'state',
                        width: '8.72%',
                        className: 'availability-status',
                        sortable: true,
                        render: function (h, params) {
                            var style = ""
                            var statusMsg = ''
                            var imgUrl = ''
                            if (params.row.mediaInfo.imgList.length > 0){
                                imgUrl = params.row.mediaInfo.imgList[0].url
                            } else if(params.row.mediaInfo.panorama.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.panorama[0].url
                            } else if (params.row.mediaInfo.videoInfo.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.videoInfo[0].url
                            } else {
                                imgUrl = '../images/1.png'
                            }
                            switch (params.row.status) {
                                case "0": {
                                    style = "hair"
                                    statusMsg = '发'
                                    break
                                }
                                case "1": {
                                    style = "can"
                                    statusMsg = '审'
                                    break
                                }
                                case "2": {
                                    style = "trial"
                                    statusMsg = '待'
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'availability-status'
                                },
                                style: {
                                    'background-image': 'url(' + imgUrl + ')'
                                }
                            }, [
                                h('em', {
                                    attrs: {
                                        class: style
                                    }
                                }, statusMsg)
                            ])
                        }
                    },
                    {
                        title: '房源标题/房源位置',
                        key: 'titlePosition',
                        className: 'title-position',
                        sortable: true,
                        width: '23%',
                        render: function (h, params) {
                            var style = ""
                            switch (params.row.publicStatus) {
                                case "0": {
                                    style = "jie"
                                    break
                                }
                                case "1": {
                                    style = "gong"
                                    break
                                }
                                case "2": {
                                    style = "cang"
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'houseTitle title-position'
                                }
                            }, [
                                h('strong', [
                                    h('span', params.row.title),
                                    h('i', {
                                        attrs: {
                                            class: style
                                        }
                                    })
                                ]),
                                h('p', {
                                    domProps: {
                                        innerHTML: params.row.houseInfo.city + params.row.houseInfo.area + params.row.houseInfo.address
                                    }
                                })
                            ])
                        }
                    },
                    {
                        title: '建议售价/业主底价',
                        width: '12%',
                        key: 'lowPrice',
                        render: function (h, params) {
                            return h('div', [
                                h('span', params.row.introPrice.price),
                                h('span', '/'),
                                h('span', params.row.introPrice.lowPrice)
                            ])
                        }
                    },
                    {
                        title: '户型/面积',
                        key: 'sizeArea',
                        width: '10.35%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', {
                                    domProps: {
                                        innerHTML: params.row.doorInfo.room + '  室  ' + params.row.doorInfo.living + '  厅'
                                    }
                                }),
                                h('p', params.row.doorInfo.roomBuildingArea)
                            ])
                        }
                    },
                    {
                        title: '录入信息',
                        key: 'inputInformation',
                        sortable: true,
                        width: '9.42%',
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.enterInfo.name),
                                h('p', params.row.enterInfo.enterTime)
                            ])
                        }
                    },
                    {
                        title: '业主信息',
                        key: 'ownerInformation',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.ownerInformation.name),
                                h('p', params.row.ownerInformation.mainPhone)
                            ])
                        }
                    },
                    {
                        title: '房源标签',
                        key: 'listingsTags',
                        width: '180',
                        render: function (h, params) {
                            var tempTag = []

                            params.row.livingInDetails.forEach(function (t, index) {
                                if (t.show) {
                                    tempTag.push(h('span', {
                                        attrs: {
                                            class: 'biaoqian-' + (index + 1)
                                        }
                                    }, t.key))
                                }
                            });
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, tempTag)
                        }
                    },
                    {
                        title: '操作',
                        width: '10%',
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, [
                                h('span', {
                                    attrs: {
                                        class: 'see privateSee'
                                    },
                                    on: {
                                        click: function () {
                                            that.show = true
                                            that.showType = 0
                                            that.privateHomeInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', {}, '查看')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'l-upload'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', {}, '发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'release'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '一键发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'modify'
                                    },
                                    on: {
                                        click: function () {
                                            that.showType = 1
                                            that.show = true
                                            that.privateHomeInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '修改')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'move-defaut'
                                    },
                                    on: {
                                        click: function () {
                                            that.delObjId = params.row.id
                                            that.deletePos = true
                                        }
                                    }
                                }, [
                                    h('em', '删除')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'recovery'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('恢复成功')
                                                } else {
                                                    that.$Message.error('恢复失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '恢复')
                                ])
                            ])
                        }
                    }
                ]
            },
            initData: function () {
                var that = this
                $.getJSON("../../data/house/mock_private_house_info.json")
                    .done(function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    })
            },
            ok: function () {
                this.$Message.info('点击了确定');
            },
            cancel: function () {
                this.$Message.info('点击了取消');
            },

        }
    });

    /*工地厂房表格模板开始*/
    Vue.component('workshop-table-pannel', {
        template: "#workshop-table-pannel-template",
        components: {
            workshopModal: workshopModal,
            paging: Paging,
        },
        data: function () {
            return {
                showType: 0,
                addMapId: 'workshopAddHouseAmapId',
                mapId: 'workshopAmapId',
                deletePos: false,
                delObjId: '',
                amapDomId: 'addWorkshop',
                isShowModal: false,
                /*默认排序*/
                sort: [
                    {
                        value: 'morenpaixuy',
                        label: '默认排序1',
                    },
                    {
                        value: 'morenpaixue',
                        label: '默认排序2'
                    },
                    {
                        value: 'morenpaixus',
                        label: '默认排序3'
                    }
                ],
                defaultSort: '',
                /*房源类别*/
                housingResources: "",
                resources: [
                    {label: "房源类别1", value: "房源类别1"},
                    {label: "房源类别2", value: "房源类别2"},
                ],
                /*房源区域*/
                housingArea: "",
                area: [
                    {label: "海口市", value: "海口市"},
                    {label: "三亚市", value: "三亚市"},
                    {label: "陵水县", value: "陵水县"},
                ],
                /*售价范围*/
                priceRange: "",
                range: [
                    {label: "不限", value: "不限"},
                    {label: "200万以下", value: "200万以下"},
                    {label: "200万以上", value: "200万以上"},
                ],
                /*面积范围*/
                areaScope: "",
                scope: [
                    {label: "不限", value: "不限"},
                    {label: "1万平米", value: "1万平米"},
                    {label: "2万平米", value: "2万平米"},
                ],

                /*楼栋数*/
                ban: "",
                banM: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],
                /*特藏属性*/
                attribute: "",
                attributeM: [
                    {label: "全部房源", value: "全部房源"},
                    {label: "全部房源1", value: "全部房源1"},
                    {label: "全部房源2", value: "全部房源2"},
                ],
                keyword: "",
                listTableData: [],
                columnsList: [],
                workshopInfo: {},
                show: false,
                totalRows:0,
                pageSize:10,
                pageIndex:0
            }
        },
        created: function () {
            this.initData()
            this.initColumns()
        },
        watch: {
            listTableData: function () {
                this.totalRows = this.listTableData.length
            },
            housingResources: function () {
                this.getSearchData()
            },
            housingArea: function () {
                this.getSearchData()
            },
            priceRange: function () {
                this.getSearchData()
            },
            areaScope: function () {
                this.getSearchData()
            },
            ban: function () {
                this.getSearchData()
            },
            attribute: function () {
                this.getSearchData()
            }
        },
        methods: {
            searchData: function (pageIndex) {
                // 获取当前页码数据
                this.pageIndex = pageIndex
                this.getSearchData()
            },
            editWorkshop: function (obj) {
                for(var i = 0; i < this.listTableData.length; i++){
                    if (this.listTableData[i].id === obj.id){
                        this.listTableData[i] = obj
                    }
                }
                this.listTableData = this.listTableData.slice()
            },
            addWorkshop: function (obj) {
                this.listTableData.push(obj)
            },
            search: function () {
                this.getSearchData()
            },
            handleSuccessDel: function () {
                var that = this
                this.listTableData.forEach(function (t, index) {
                    if (t.id === that.delObjId) {
                        that.listTableData.splice(index, 1)
                    }
                })

            },
            getSearchData: function () {
                var that = this
                $.getJSON(
                    '../../data/company/mock_user.json',
                    {
                        housingResources: this.housingResources,
                        housingArea: this.housingArea,
                        priceRange: this.priceRange,
                        areaScope: this.areaScope,
                        ban: this.ban,
                        attribute: this.attribute,
                        keyword: this.keyword,
                        page: this.pageIndex
                    },
                    function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    }, function (err) {

                    }
                )
            },
            showAddHouse: function () {
                this.showType = 2
                this.show = true
            },
            initColumns: function () {
                var that = this
                this.columnsList = [
                    {
                        type: 'selection',
                        width: '2.78%',
                        align: 'left'
                    },
                    {
                        title: '房源状态',
                        key: 'state',
                        width: '8.72%',
                        className: 'availability-status',
                        sortable: true,
                        render: function (h, params) {
                            var style = ""
                            var statusMsg = ''
                            var imgUrl = ''
                            if (params.row.mediaInfo.imgList.length > 0){
                                imgUrl = params.row.mediaInfo.imgList[0].url
                            } else if(params.row.mediaInfo.panorama.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.panorama[0].url
                            } else if (params.row.mediaInfo.videoInfo.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.videoInfo[0].url
                            } else {
                                imgUrl = '../images/1.png'
                            }
                            switch (params.row.status) {
                                case "0": {
                                    style = "hair"
                                    statusMsg = '发'
                                    break
                                }
                                case "1": {
                                    style = "can"
                                    statusMsg = '审'
                                    break
                                }
                                case "2": {
                                    style = "trial"
                                    statusMsg = '待'
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'availability-status'
                                },
                                style: {
                                    'background-image': 'url(' + imgUrl + ')'
                                }
                            }, [
                                h('em', {
                                    attrs: {
                                        class: style
                                    }
                                }, statusMsg)
                            ])
                        }
                    },
                    {
                        title: '房源标题/房源位置',
                        key: 'titlePosition',
                        className: 'title-position',
                        sortable: true,
                        width: '23%',
                        render: function (h, params) {
                            var style = ""
                            switch (params.row.publicStatus) {
                                case "0": {
                                    style = "jie"
                                    break
                                }
                                case "1": {
                                    style = "gong"
                                    break
                                }
                                case "2": {
                                    style = "cang"
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'houseTitle title-position'
                                }
                            }, [
                                h('strong', [
                                    h('span', params.row.title),
                                    h('i', {
                                        attrs: {
                                            class: style
                                        }
                                    })
                                ]),
                                h('p', {
                                    domProps: {
                                        innerHTML: params.row.basicInfo.city + params.row.basicInfo.area + params.row.basicInfo.address
                                    }
                                })
                            ])
                        }
                    },
                    {
                        title: '建议售价/业主底价',
                        width: '12%',
                        key: 'lowPrice',
                        render: function (h, params) {
                            return h('div', [
                                h('span', params.row.introPrice.price),
                                h('span', '/'),
                                h('span', params.row.introPrice.lowPrice)
                            ])
                        }
                    },
                    {
                        title: '楼栋数/面积',
                        key: 'sizeArea',
                        width: '10.35%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', {
                                    domProps: {
                                        innerHTML: params.row.basicInfo.buildingBlock
                                    }
                                }),
                                h('p', params.row.basicInfo.roomBuildingArea)
                            ])
                        }
                    },
                    {
                        title: '录入信息',
                        key: 'inputInformation',
                        width: '9.42%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.enterInfo.name),
                                h('p', params.row.enterInfo.enterTime)
                            ])
                        }
                    },
                    {
                        title: '业主信息',
                        key: 'ownerInformation',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.ownerInformation.name),
                                h('p', params.row.ownerInformation.mainPhone)
                            ])
                        }
                    },
                    {
                        title: '房源标签',
                        key: 'listingsTags',
                        width: '180',
                        render: function (h, params) {
                            var tempTag = []

                            params.row.livingInDetails.forEach(function (t, index) {
                                if (t.show) {
                                    tempTag.push(h('span', {
                                        attrs: {
                                            class: 'biaoqian-' + (index + 1)
                                        }
                                    }, t.key))
                                }
                            });
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, tempTag)
                        }
                    },
                    {
                        title: '操作',
                        width: '10%',
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, [
                                h('span', {
                                    attrs: {
                                        class: 'see workshopSee'
                                    },
                                    on: {
                                        click: function () {
                                            that.show = true
                                            that.showType = 0
                                            that.workshopInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '查看')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'l-upload'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'release'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '一键发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'modify'
                                    },
                                    on: {
                                        click: function () {
                                            that.show = true
                                            that.showType = 1
                                            that.workshopInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '修改')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'move-defaut'
                                    },
                                    on: {
                                        click: function () {
                                            that.delObjId = params.row.id
                                            that.deletePos = true
                                        }
                                    }
                                }, [
                                    h('em', '删除')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'recovery'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('恢复成功')
                                                } else {
                                                    that.$Message.error('恢复失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '恢复')
                                ])
                            ])
                        }
                    }
                ]
            },
            initData: function () {
                var that = this
                $.getJSON("../../data/house/mock_workshop_info.json")
                    .done(function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    })
            },
            ok: function () {
                this.$Message.info('点击了确定');
            },
            cancel: function () {
                this.$Message.info('点击了取消');
            },

        }
    });

    /*土地表格模板开始*/
    Vue.component('land-table-pannel', {
        template: "#land-table-pannel-template",
        components: {
            landModal: landModal,
            paging: Paging,
        },
        data: function () {
            var that = this
            return {
                showType: 0,
                addMapId: 'landAddHouseAmapId',
                mapId: 'landAmapId',
                deletePos: false,
                delObjId: '',
                amapDomId: 'addLand',
                isShowModal: false,
                /*默认排序*/
                sort: [
                    {
                        value: 'morenpaixuy',
                        label: '默认排序1',
                    },
                    {
                        value: 'morenpaixue',
                        label: '默认排序2'
                    },
                    {
                        value: 'morenpaixus',
                        label: '默认排序3'
                    }
                ],
                defaultSort: '',
                /*房源类别*/
                housingResources: "",
                resources: [
                    {label: "房源类别1", value: "房源类别1"},
                    {label: "房源类别2", value: "房源类别2"},
                ],
                /*房源区域*/
                housingArea: "",
                area: [
                    {label: "海口市", value: "海口市"},
                    {label: "三亚市", value: "三亚市"},
                    {label: "陵水县", value: "陵水县"},
                ],
                /*售价范围*/
                priceRange: "",
                range: [
                    {label: "不限", value: "不限"},
                    {label: "200万以下", value: "200万以下"},
                    {label: "200万以上", value: "200万以上"},
                ],
                /*面积范围*/
                areaScope: "",
                scope: [
                    {label: "不限", value: "不限"},
                    {label: "1万平米", value: "1万平米"},
                    {label: "2万平米", value: "2万平米"},
                ],

                /*年限*/
                life: "",
                lifeM: [
                    {label: "不限", value: "不限"},
                    {label: "两室一厅", value: "两室一厅"},
                    {label: "三室一厅", value: "三室一厅"},
                ],
                /*特藏属性*/
                attribute: "",
                attributeM: [
                    {label: "全部房源", value: "全部房源"},
                    {label: "全部房源1", value: "全部房源1"},
                    {label: "全部房源2", value: "全部房源2"},
                ],
                keyword: "",
                show: false,
                landInfo: {},
                columnsList: [
                    {
                        type: 'selection',
                        width: '2.78%',
                        align: 'left'
                    },
                    {
                        title: '房源状态',
                        key: 'state',
                        width: '8.72%',
                        className: 'availability-status',
                        sortable: true,
                        render: function (h, params) {
                            var style = ""
                            var statusMsg = ''
                            var imgUrl = ''
                            if (params.row.mediaInfo.imgList.length > 0){
                                imgUrl = params.row.mediaInfo.imgList[0].url
                            } else if(params.row.mediaInfo.panorama.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.panorama[0].url
                            } else if (params.row.mediaInfo.videoInfo.length > 0 && imgUrl === ''){
                                imgUrl = params.row.mediaInfo.videoInfo[0].url
                            } else {
                                imgUrl = '../images/1.png'
                            }
                            switch (params.row.status) {
                                case "0": {
                                    style = "hair"
                                    statusMsg = '发'
                                    break
                                }
                                case "1": {
                                    style = "can"
                                    statusMsg = '审'
                                    break
                                }
                                case "2": {
                                    style = "trial"
                                    statusMsg = '待'
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'availability-status'
                                },
                                style: {
                                    'background-image': 'url(' + imgUrl + ')'
                                }
                            }, [
                                h('em', {
                                    attrs: {
                                        class: style
                                    }
                                }, statusMsg)
                            ])
                        }
                    },
                    {
                        title: '房源标题/房源位置',
                        key: 'titlePosition',
                        className: 'title-position',
                        sortable: true,
                        width: '23%',
                        render: function (h, params) {
                            var style = ""
                            switch (params.row.publicStatus) {
                                case "0": {
                                    style = "jie"
                                    break
                                }
                                case "1": {
                                    style = "gong"
                                    break
                                }
                                case "2": {
                                    style = "cang"
                                    break
                                }
                            }
                            return h('div', {
                                attrs: {
                                    class: 'houseTitle title-position'
                                }
                            }, [
                                h('strong', [
                                    h('span', params.row.title),
                                    h('i', {
                                        attrs: {
                                            class: style
                                        }
                                    })
                                ]),
                                h('p', {
                                    domProps: {
                                        innerHTML: params.row.basicInfo.city + params.row.basicInfo.area + params.row.basicInfo.address
                                    }
                                })
                            ])
                        }
                    },
                    {
                        title: '建议售价/业主底价',
                        width: '12%',
                        key: 'lowPrice',
                        render: function (h, params) {
                            return h('div', [
                                h('span', params.row.introPrice.price),
                                h('span', '/'),
                                h('span', params.row.introPrice.lowPrice)
                            ])
                        }
                    },
                    {
                        title: '年限/面积',
                        key: 'sizeArea',
                        width: '10.35%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', {
                                    domProps: {
                                        innerHTML: params.row.basicInfo.durableYears
                                    }
                                }),
                                h('p', params.row.basicInfo.plantArea)
                            ])
                        }
                    },
                    {
                        title: '录入信息',
                        key: 'inputInformation',
                        width: '9.42%',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.enterInfo.name),
                                h('p', params.row.enterInfo.enterTime)
                            ])
                        }
                    },
                    {
                        title: '业主信息',
                        key: 'ownerInformation',
                        sortable: true,
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'title-position'
                                }
                            }, [
                                h('strong', params.row.ownerInformation.name),
                                h('p', params.row.ownerInformation.mainPhone)
                            ])
                        }
                    },
                    {
                        title: '房源标签',
                        key: 'listingsTags',
                        width: '180',
                        render: function (h, params) {
                            var tempTag = []

                            params.row.livingInDetails.forEach(function (t, index) {
                                if (t.show) {
                                    tempTag.push(h('span', {
                                        attrs: {
                                            class: 'biaoqian-' + (index + 1)
                                        }
                                    }, t.key))
                                }
                            });
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, tempTag)
                        }
                    },
                    {
                        title: '操作',
                        width: '10%',
                        render: function (h, params) {
                            return h('div', {
                                attrs: {
                                    class: 'listings-tags'
                                }
                            }, [
                                h('span', {
                                    attrs: {
                                        class: 'see landSee'
                                    },
                                    on: {
                                        click: function () {
                                            that.show = true
                                            that.showType = 0
                                            that.landInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', {}, '查看')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'l-upload'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'release'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('发布成功')
                                                } else {
                                                    that.$Message.error('发布失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '一键发布')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'modify'
                                    },
                                    on: {
                                        click: function () {
                                            that.show = true
                                            that.showType = 1
                                            that.landInfo = params.row
                                        }
                                    }
                                }, [
                                    h('em', '修改')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'move-defaut'
                                    },
                                    on: {
                                        click: function () {
                                            that.delObjId = params.row.id
                                            that.deletePos = true
                                        }
                                    }
                                }, [
                                    h('em', '删除')
                                ]),
                                h('span', {
                                    attrs: {
                                        class: 'recovery'
                                    },
                                    on: {
                                        click: function () {
                                            $.ajax({
                                                type: 'post',
                                                url: '../data/common/mock_post_ok.json',
                                                contentType: "application/json; charset=utf-8",
                                                data: JSON.stringify({id: params.row.id}),
                                                dataType: "json"
                                            }).done(function (res) {
                                                if (res.IsSuccess) {
                                                    that.$Message.success('恢复成功')
                                                } else {
                                                    that.$Message.error('恢复失败')
                                                }
                                            })
                                        }
                                    }
                                }, [
                                    h('em', '恢复')
                                ])
                            ])
                        }
                    }
                ],
                listTableData: [],
                totalRows:0,
                pageSize:10,
                pageIndex:0
            }
        },
        created: function () {
            this.initData()
        },
        watch: {
            listTableData: function () {
                this.totalRows = this.listTableData.length
            },
            housingResources: function () {
                this.getSearchData()
            },
            housingArea: function () {
                this.getSearchData()
            },
            priceRange: function () {
                this.getSearchData()
            },
            areaScope: function () {
                this.getSearchData()
            },
            life: function () {
                this.getSearchData()
            },
            attribute: function () {
                this.getSearchData()
            }
        },
        methods: {
            searchData: function (pageIndex) {
                // 获取当前页码数据
                this.pageIndex = pageIndex
                this.getSearchData()
            },
            editLand: function (obj) {
                for(var i = 0; i < this.listTableData.length; i++){
                    if (this.listTableData[i].id === obj.id){
                        this.listTableData[i] = obj
                    }
                }
                this.listTableData = this.listTableData.slice()
            },
            addLand: function (obj) {
                this.listTableData.push(obj)
            },
            search: function () {
                this.getSearchData()
            },
            handleSuccessDel: function () {
                var that = this
                this.listTableData.forEach(function (t, index) {
                    if (t.id === that.delObjId) {
                        that.listTableData.splice(index, 1)
                    }
                })

            },
            getSearchData: function () {
                var that = this
                $.getJSON(
                    '../../data/company/mock_user.json',
                    {
                        housingResources: this.housingResources,
                        housingArea: this.housingArea,
                        priceRange: this.priceRange,
                        areaScope: this.areaScope,
                        life: this.life,
                        attribute: this.attribute,
                        keyword: this.keyword,
                        page: this.pageIndex
                    },
                    function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    }, function (err) {

                    }
                )
            },
            showAddHouse: function () {
                this.showType = 2
                this.show = true
            },
            initData: function () {
                var that = this
                $.getJSON("../../data/house/mock_house_info.json")
                    .done(function (res) {
                        if (res.IsSuccess) {
                            that.listTableData = res.ResultObject
                        }
                    })
            },
            ok: function () {
                this.$Message.info('点击了确定');
            },
            cancel: function () {
                this.$Message.info('点击了取消');
            }
        }
    });


    var app = new Vue({
        el: "#app"
    });
})
